define(['jquery'],function($){
    function Utils() {



    }

    // Utils._reportException = function (msg) {
    //     if (arguments.length > 1) {
    //         throw String_format(msg, arguments);
    //     }
    //
    //     throw msg;
    // };

    // Utils.prototype._xx = function () {
    //
    // }
    //
    // Utils.getInstance = function () {
    //     return new Utils();
    // }

    // return Utils;

    var String_format = function(str){
        if (str == null || str.length == 0) {
            return "";
        }

        if (str.indexOf('%s') == -1) {
            return str;
        }

        var arr = str.split('%s');

        if (arr.length > arguments.length) {
            throw 'The number of actual parameters more than number of placeholders!';
        }

        var args = [];
        var str = arr[0];
        for (var arg in arguments) {
            if (arg == 0) {
                continue;
            }
            str += arguments[arg] + arr[arg];
        }

        return str;
    };
    //判断非空 为空返回true
    var is_empty = function(obj){
        if (obj != null && obj !== 0 && obj !== '') {
            return false;
        }
        if (obj == undefined
            || obj == null
            || obj == '') {
            return true;
        }
    };
    var base_64 = function (input) {
        var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
        // public method for encoding
        this.encode = function (input) {
            var output = "";
            var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
            var i = 0;
            input = _utf8_encode(input);
            while (i < input.length) {
                chr1 = input.charCodeAt(i++);
                chr2 = input.charCodeAt(i++);
                chr3 = input.charCodeAt(i++);
                enc1 = chr1 >> 2;
                enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
                enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
                enc4 = chr3 & 63;
                if (isNaN(chr2)) {
                    enc3 = enc4 = 64;
                } else if (isNaN(chr3)) {
                    enc4 = 64;
                }
                output = output +
                    _keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
                    _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
            }
            return output;
        };
    };

    var _reportException = function (msg) {
        if (arguments.length > 1) {
            throw String_format(msg, arguments);
        }

        throw msg;
    };

    return{
        String_format:String_format,
        is_empty:is_empty,
        base_64:base_64
    }
})